package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
 * 文件复制(单字节读写)
 */
public class CopyDemo {
    public static void main(String[] args) throws IOException {
        //166e183e84094c44bbc8ad66500cef5b.jpeg
        FileInputStream fis = new FileInputStream("001.png");
        FileOutputStream fos = new FileOutputStream("0001.png");
        long start = System.currentTimeMillis();
        int d;
        while ((d = fis.read()) != -1) {
            fos.write(d);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕，耗时"+(end - start)+"毫秒");
        fis.close();
        fos.close();
    }
}
